using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;


/// <summary>
/// Summary description for UserProfile
/// </summary>
public class UserProfile
{
    //variables assigned for user personal details
    private string firstName;
    private string lastName;
    private string address1;
    private string address2;
    private string city;
    private string region;
    private string postCode;
    private string country;
    private string phone;
    private string fax;
    private string companyName;
    private string companyNip;

    //gets user details
    public UserProfile()
    {
        ProfileCommon profile = HttpContext.Current.Profile as ProfileCommon;
        firstName = profile.FirstName;
        lastName = profile.LastName;
        address1 = profile.Address1;
        address2 = profile.Address2;
        city = profile.City;
        region = profile.Region;
        postCode = profile.PostCode;
        country = profile.Country;
        phone = profile.Phone;
        fax = profile.Fax;
        companyName = profile.CompanyName;
        companyNip = profile.CompanyNip;
    }
    //updates user profile
    public void UpdateProfile()
    {
        ProfileCommon profile = HttpContext.Current.Profile as ProfileCommon;

        profile.FirstName = firstName;
        profile.LastName = lastName;
        profile.Address1 = address1;
        profile.Address2 = address2;
        profile.City = city;
        profile.Region = region;
        profile.PostCode = postCode;
        profile.Country = country;
        profile.Phone = phone;
        profile.Fax = fax;
        profile.CompanyName = companyName;
        profile.CompanyNip = companyNip;
       // MembershipUser user = Membership.GetUser(profile.UserName);
        //user.Email = email;
        //Membership.UpdateUser(user);
    }
    //properties used to get and update user profie details
    public string FirstName
    {
        get
        {
            return firstName;
        }
        set
        {
            firstName = value;
        }
    }

    public string Lastname
    {
        get
        {
            return lastName;
        }
        set
        {
            lastName = value;
        }
    }

    public string Address1
    {
        get
        {
            return address1;
        }
        set
        {
            address1 = value;
        }
    }

    public string Address2
    {
        get
        {
            return address2;
        }
        set
        {
            address2 = value;
        }
    }

    public string City
    {
        get
        {
            return city;
        }
        set
        {
            city = value;
        }
    }

    public string Region
    {
        get
        {
            return region;
        }
        set
        {
            region = value;
        }
    }

    public string PostCode
    {
        get
        {
            return postCode;
        }
        set
        {
            postCode = value;
        }
    }

    public string Country
    {
        get
        {
            return country;
        }
        set
        {
            country = value;
        }
    }

    public string Phone
    {
        get
        {
            return phone;
        }
        set
        {
            phone = value;
        }
    }
    public string Fax
    {
        get
        {
            return fax;
        }
        set
        {
            fax = value;
        }
    }

    public string CompanyName
    {
        get
        {
            return companyName;
        }
        set
        {
            companyName = value;
        }
    }

    public string CompanyNip
    {
        get
        {
            return companyNip;
        }
        set
        {
            companyNip = value;
        }
    }
}
